home *** CD-ROM | disk | FTP | other *** search
/ Info-Mac 4 / Info_Mac IV CD-ROM (Pacific HiTech Inc.)(August 1994).iso / Development / Source / MSG Demo 1.4.source Folder / Demo ƒ / Shell ƒ / util.c < prev    next >
Text File  |  1994-04-15  |  2KB  |  52 lines

  1. /**********************************************************************\
  2.  
  3. File:        util.c
  4.  
  5. Purpose:    This module handles standard memory copying and comparing.
  6.  
  7. This program is free software; you can redistribute it and/or modify
  8. it under the terms of the GNU General Public License as published by
  9. the Free Software Foundation; either version 2 of the License, or
  10. (at your option) any later version.
  11.  
  12. This program is distributed in the hope that it will be useful,
  13. but WITHOUT ANY WARRANTY; without even the implied warranty of
  14. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  15. GNU General Public License for more details.
  16.  
  17. You should have received a copy of the GNU General Public License
  18. along with this program in a file named "GNU General Public License".
  19. If not, write to the Free Software Foundation, 675 Mass Ave,
  20. Cambridge, MA 02139, USA.
  21.  
  22. \**********************************************************************/
  23.  
  24. #include "util.h"
  25.  
  26. void Mymemcpy(Ptr output, Ptr input, unsigned long len)
  27. /* like unix memcpy -- output first, then input, then length */
  28. {
  29.     BlockMove(input, output, len);
  30. }
  31.  
  32. void Mymemset(Ptr output, unsigned char value, unsigned long len)
  33. /* Good for zeroing sensitive data.  Not that I have anything sensitive, of course ;) */
  34. {
  35.     unsigned long    i;
  36.     
  37.     for (i=0; i<len; i++)
  38.         *((unsigned char*)((long)output+i))=value;
  39. }
  40.  
  41. Boolean Mymemcompare(Ptr thisThing, Ptr thatThing, unsigned char len)
  42. /* standard memory compare, byte for byte */
  43. {
  44.     unsigned char    i;
  45.     Boolean            goon;
  46.     
  47.     goon=TRUE;
  48.     for (i=0; (i<len) && (goon); i++)
  49.         goon=(*((unsigned char*)((long)thisThing+i))==*((unsigned char*)((long)thatThing+i)));
  50.     return goon;
  51. }
  52.